<?php
  include ('header.php');
?>
<head>
<title><?php echo $titles['admin_edit_tables']?></title>
</head>
 <script type="text/javascript">
$(document).ready(function(){

$('#activities_limit').change(function()
{
   alert('Value change to ' + $(this).attr('value'));
});
});
</script>
<body>
<?php

if($_SESSION['access']<2)
{
DIE('Помилка: Ви не маєте права доступу до сайту');
}
$sql2="SELECT * FROM edit_tables ";  
$process2=mysql_query($sql2, $db);
$i=1;
$row2 = mysql_fetch_array($process2, $i);/*
$num_rows = mysql_num_fields($process2);
echo ">>>>".$num_rows;
echo mysql_field_name($process2, 0);*/
if (isset ($_POST['edit_tables'])){
$_SESSION['edit_tables']=$_POST['edit_tables'];
}
else $_SESSION['edit_tables']=$row2[table_name];
?>

<form name=tables_edit method=POST>
<table class="IND_INVENTORY">
<tr><td>
<SELECT NAME="edit_tables" onchange='document.forms["tables_edit"].submit();' >
<?php 

$sql2="SELECT * FROM edit_tables ";  
$process2=mysql_query($sql2, $db);
$i=1;
while ($row2 = mysql_fetch_array($process2, $i)){
$selected=($row2[table_name]==$_SESSION['edit_tables']) ? ' selected' :'';
echo "<option value='".$row2[table_name]."' ".$selected.">".$row2[table_description]."</option>";
}
?>
</SELECT>

</td><td><input type="button" value="редагувати" name="new"  id="edit tabke"></td>
</tr>
</table>


</form>
</body>
<?php
  include ('footer.php');
?>